package handler

import "github.com/gin-gonic/gin"

type Result struct {
	// 业务错误码
	Code int	`json:"code"`
	Msg string	`json:"msg"`
	Data any	`json:"data"`
	Count int64 `json:"count"`
}

func ReturnSuccess (c *gin.Context, code int, msg string, data any, count int64) {
	json:=&Result{
		Code:code,
		Msg: msg,
		Data: data,
		Count: count,
	}
	c.JSON(200, json)
}

func ReturnError (c *gin.Context, code int, msg string) {
	json:=&Result{
		Code:code,
		Msg: msg,
	}
	c.JSON(200, json)
}
